package com.mdh.runerrands.serviceImpl;

import com.mdh.runerrands.dao.CommentDao;
import com.mdh.runerrands.pojo.Comment;
import com.mdh.runerrands.service.ICommentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CommentServiceImpl implements ICommentService {
    @Resource
    private CommentDao commentDao;

    @Override
    public boolean batchDelete(int... ids) {
        return commentDao.batchDelete(ids);
    }

    @Override
    public boolean updateComment(int id, String status) {
        return commentDao.updateComment(id,status);
    }

    @Override
    public boolean deleteById(int id) {
        return commentDao.delete(id);
    }

    @Override
    public List<Comment> findByCusId(int cusId) {
        return commentDao.selectByCusId(cusId);
    }

    @Override
    public List<Comment> query(int page, int pageSize, String content, Long commentTime, Integer cusId, Integer orderId) {
        page = (page-1)*pageSize;

        return commentDao.query(page,pageSize,content,commentTime,cusId,orderId);
    }

    @Override
    public int selectCount(String content, Long commentTime, Integer cusId, Integer orderId) {
        return commentDao.selectCount(content,commentTime,cusId,orderId);
    }

    @Override
    public boolean insert(Comment comment) {
        return commentDao.insert(comment);
    }

    @Override
    public boolean update(Comment comment) {
        return commentDao.update(comment);
    }

    @Override
    public List<Comment> findByOrderId(Integer orderId) {
        return commentDao.selectByOrderId(orderId);
    }
}
